// package: rewords-server-2024
// filename: common
// author: diogoxiang@gmail.com
// time: 2024/11/22 14:05
// desc: 上传的 文件

package common

import (
	"github.com/gogf/gf/v2/frame/g"
	"rewords-server-2024/internal/model/outin"
)

// UploadFileReq 上传文件
type UploadFileReq struct {
	g.Meta `path:"/upload/file" tags:"附件" method:"post" summary:"上传附件-本地"`
}

// FileInfo 文件信息
type FileInfo struct {
	OriginalName string `json:"original_name" dc:"原始文件名"`
	SaveName     string `json:"save_name" dc:"保存的文件名"`
	SavePath     string `json:"save_path" dc:"保存路径"`
	Size         int64  `json:"size" dc:"文件大小(字节)"`
	Type         string `json:"type" dc:"文件类型"`
}

type UploadFileRes struct {
	Url   string     `json:"url" dc:"如是单个的话,就是文件的url"`
	Id    string     `json:"id" dc:"文件的ID"`
	Files []FileInfo `json:"files" dc:"上传的文件列表"`
}

// UploadQiniuReq 上传文件 获取七牛云上传token
type UploadQiniuReq struct {
	g.Meta `path:"/upload/qiniu/uptoken" tags:"附件" method:"get" summary:"上传附件-七牛云"`
}
type UploadQiniuRes struct {
	UploadToken string `json:"uptoken"`
}

// UpInfoReq 更新上传信息
type UpInfoReq struct {
	g.Meta `path:"/upload/upinfo" tags:"附件" method:"get" summary:"更新上传信息, 通过七牛上传的图片,保存"`
	// Id     string `json:"id" dc:"附件ID"`
	Url   string `json:"url" v:"required#上传地址不能为空" dc:"上传地址"`
	Title string `json:"title" dc:"标题"`
}
type UpInfoRes struct{}

type ImagesReq struct {
	g.Meta   `path:"/upload/images/querylist" tags:"附件" method:"get" summary:"图片库的列表"`
	PageNum  int64 `json:"pageNum" v:"min:1#请输入正确的页码" dc:"当前页"`
	PageSize int64 `json:"pageSize" v:"min:1#请输入正确的页码" dc:"数量"`
}
type ImagesRes struct {
	List []outin.ImageItem `json:"list"`
}
